Skip to content

refactor(fjl)!: move find* and reduce* out of list/utils - #145

Merged
elycruz merged 1 commit into
mainfrom
83-find-reduce-consolidation
Nov 3, 2026
Merged

elycruz merged 1 commit into
mainfrom
83-find-reduce-consolidation

Conversation

@elycruz

@elycruz elycruz commented Nov 3, 2026

Copy link
Copy Markdown
Member

Summary

Every find* and reduce* pair shipped under two names, with the real code in list/utils. This makes the public modules the real implementations.

Before After
findWhere Removed; find is the implementation
findIndexWhere Removed; findIndex is the implementation
findIndicesWhere Removed; findIndices is the implementation
findIndexWhereRight Renamed to findLastIndex, in list/findLastIndex.ts
foldl = reduce foldl is the implementation; reduce = foldl
foldr = reduceRight foldr is the implementation; reduceRight = foldr
list/utils/reduceUntil* list/reduceUntil*, same names

The $ forms follow the same changes. The other utils (slice*, lastIndex, lengths, toShortest, swap, genericAscOrdering) stay in list/utils.

Closes #83

Breaking changes

The four *Where names and their $ forms are gone from the public API. No sibling package uses them. Migration notes are tracked in #142.

Tests

  • The find* and reduce* tests moved from tests/list-utils/ to tests/list/.
  • The wider tables from test-findWhere and test-findIndexWhere are merged into test-find and test-findIndex.
  • test-findIndicesWhere is deleted because it duplicated test-findIndices.
  • New findLastIndex case with duplicate matches, since the old cases only used unique values and couldn't tell which end the search started from.
  • tests/test-currying.ts registry updated. The expected curried method count goes from 109 to 108 (111 exports minus the 3 removed).

Testing

  • pnpm test: 130 suites and 1445 tests pass. That's 12 fewer tests than before, because the duplicate suite and the removed $ forms are gone.
  • npx tsc --noEmit -p packages/fjl/tsconfig.json: clean
  • pnpm build: succeeds. Checked against dist/cjs/index.cjs: the removed names are gone, the new and kept names are present, and the aliases are the same functions as foldl and foldr.
  • eslint on changed files: no errors, and 4 unused-import warnings that were already in the moved test files

🤖 Generated with Claude Code

…out of list/utils

find, findIndex, findIndices, foldl and foldr now hold the real implementations.
reduce and reduceRight stay public as aliases of foldl and foldr. reduceUntil and
reduceUntilRight move to list/ under the same names. The other utils stay in list/utils.

BREAKING CHANGE: findWhere, findIndexWhere and findIndicesWhere, and their $ forms, are
removed; use find, findIndex and findIndices. findIndexWhereRight is renamed to findLastIndex.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@elycruz
elycruz merged commit dec4130 into main Nov 3, 2026
3 checks passed
@elycruz
elycruz deleted the 83-find-reduce-consolidation branch November 3, 2026 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

next: find*, and reduce* set of util methods should just be their actual implementation counterparts

1 participant